xen/arm: wake up secondary cpus
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 15 Nov 2012 10:25:29 +0000 (10:25 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 15 Nov 2012 10:25:29 +0000 (10:25 +0000)
Secondary cpus are held by the firmware until we send an IPI to them.

Reordered non-boot cpu wait loop to perform the check before waiting
for an event, to handled the case where the event has already
happened when we reach the loop.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/gic.h
xen/arch/arm/head.S
xen/arch/arm/mode_switch.S
xen/include/asm-arm/platform_vexpress.h [new file with mode: 0644]

index b8f9f2017f12d031733acb248bf9c013c76f35e0..b2e1d7face12e50c8b3f9e3f9b7d9e631c3e5595 100644 (file)
 /* XXX: write this into the DT */
 #define VGIC_IRQ_EVTCHN_CALLBACK 31
 
+#ifndef __ASSEMBLY__
 extern int domain_vgic_init(struct domain *d);
 extern void domain_vgic_free(struct domain *d);
 
@@ -158,6 +159,7 @@ extern int gicv_setup(struct domain *d);
 extern void gic_save_state(struct vcpu *v);
 extern void gic_restore_state(struct vcpu *v);
 
+#endif /* __ASSEMBLY__ */
 #endif
 
 /*
index 09d43801bd87a1b50ac4b6ee717cb9e4b93b1f25..67ee3820cdcea27ede709afcd1665cd9708280dd 100644 (file)
@@ -80,12 +80,12 @@ start:
        beq   boot_cpu               /* If we're CPU 0, boot now */
 
        /* Non-boot CPUs wait here to be woken up one at a time. */
-1:     wfe
-       dsb
+1:     dsb
        ldr   r0, =smp_up_cpu        /* VA of gate */
        add   r0, r0, r10            /* PA of gate */
        ldr   r1, [r0]               /* Which CPU is being booted? */
        teq   r1, r12                /* Is it us? */
+       wfene
        bne   1b
 
 boot_cpu:
@@ -99,6 +99,10 @@ boot_cpu:
        PRINT(" booting -\r\n")
 #endif
 
+       /* Wake up secondary cpus */
+       teq   r12, #0
+       bleq  kick_cpus
+
        /* Check that this CPU has Hyp mode */
        mrc   CP32(r0, ID_PFR1)
        and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
index 83a682be6643ec55251653270966a6e00b9f4b48..7c3b3574f5a227280fcf274369bec8f7f538cc2f 100644 (file)
 
 #include <asm/config.h>
 #include <asm/page.h>
+#include <asm/platform_vexpress.h>
 #include <asm/asm_defns.h>
+#include "gic.h"
+
+
+/* XXX: Versatile Express specific code */
+/* wake up secondary cpus */
+.globl kick_cpus
+kick_cpus:
+       /* write start paddr to v2m sysreg FLAGSSET register */
+       ldr   r0, =(V2M_SYS_MMIO_BASE)        /* base V2M sysreg MMIO address */
+       dsb
+       mov   r2, #0xffffffff
+       str   r2, [r0, #(V2M_SYS_FLAGSCLR)]
+       dsb
+       ldr   r2, =start
+       add   r2, r2, r10
+       str   r2, [r0, #(V2M_SYS_FLAGSSET)]
+       dsb
+       /* send an interrupt */
+       ldr   r0, =(GIC_BASE_ADDRESS + GIC_DR_OFFSET) /* base GICD MMIO address */
+       mov   r2, #0x1
+       str   r2, [r0, #(GICD_CTLR * 4)]      /* enable distributor */
+       mov   r2, #0xfe0000
+       str   r2, [r0, #(GICD_SGIR * 4)]      /* send IPI to everybody */
+       dsb
+       str   r2, [r0, #(GICD_CTLR * 4)]      /* disable distributor */
+       mov   pc, lr
+
 
 /* Get up a CPU into Hyp mode.  Clobbers r0-r3.
  *
diff --git a/xen/include/asm-arm/platform_vexpress.h b/xen/include/asm-arm/platform_vexpress.h
new file mode 100644 (file)
index 0000000..3556af3
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __ASM_ARM_PLATFORM_H
+#define __ASM_ARM_PLATFORM_H
+
+/* V2M */
+#define V2M_SYS_MMIO_BASE     (0x1c010000)
+#define V2M_SYS_FLAGSSET      (0x30)
+#define V2M_SYS_FLAGSCLR      (0x34)
+
+#endif /* __ASM_ARM_PLATFORM_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */